import vtkProp3D from '@kitware/vtk.js/Rendering/Core/Prop3D';
import macro from '@kitware/vtk.js/macro';

function vtkAssembly(publicAPI, model) {
  model.classHierarchy.push('vtkAssembly');
  model.actors = [];
  model.props = [];

  publicAPI.getNestedProps = () => {
    return model.actors;
  };

  publicAPI.addActor = (a) => {
    model.actors.push(a);
  };

  publicAPI.addProps = (a) => {
    model.props.push(a);
  };
}

export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, initialValues);
  vtkProp3D.extend(publicAPI, model, initialValues);
  vtkAssembly(publicAPI, model);
}

// ----------------------------------------------------------------------------

export const newInstance = macro.newInstance(extend, 'vtkAssembly');

// ----------------------------------------------------------------------------

export default { newInstance, extend };
